package com.framework.base.taglib.logic;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2005</p>
 * <p>Company: 南方科能</p>
 * @author byt
 * @version 1.0
 */

import java.util.HashMap;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.tagext.TagSupport;

@SuppressWarnings("serial")
public class TalentConditionTag extends TagSupport {
	private String moduleID;// 模块ID

	public TalentConditionTag() {
		moduleID = "";
	}

	public int doStartTag() throws JspException {
		HashMap<?, ?> rightMap = (HashMap<?, ?>) pageContext.getSession().getAttribute(
				"userPermissions");
		boolean hasPermission = false;
		if (rightMap.get(moduleID) != null
				&& !"".equals(rightMap.get(moduleID)))
			hasPermission = true;
		if (hasPermission)
			return Tag.EVAL_BODY_INCLUDE;
		return Tag.SKIP_BODY;
	}

	/**
	 * 
	 * @return
	 * @throws JspException
	 */
	public int doEndTag() throws JspException {
		return 6;
	}

	public String getModuleID() {
		return moduleID;
	}

	public void setModuleID(String moduleID) {
		this.moduleID = moduleID;
	}
}
